Skip to content

Conversation

roypat
Copy link
Member

@roypat roypat commented Oct 2, 2025

Some crates, such as vhost, use compile_error!() to indicate that mutually exclusive feature have been specified. This leads to problems when running cargo doc --all-features, which will inevitably trigger these conditions and then lead to documentation not building (for this reason, the vhost documentation currently fails to build on docs.rs for example).

Add a custom cfg that gets passed via RUSTFLAGS in the cargo doc CI step on whose absense these compile_error!() macros can be gated, so that they dont cause issues when building documentation in CI

See also rust-vmm/vhost#326

Summary of the PR

Please summarize here why the changes in this PR are needed.

Requirements

Before submitting your PR, please make sure you addressed the following
requirements:

  • All commits in this PR have Signed-Off-By trailers (with
    git commit -s), and the commit message has max 60 characters for the
    summary and max 75 characters for each description line.
  • All added/changed functionality has a corresponding unit/integration
    test.
  • All added/changed public-facing functionality has entries in the "Upcoming
    Release" section of CHANGELOG.md (if no such section exists, please create one).
  • Any newly added unsafe code is properly documented.

Some crates, such as vhost, use compile_error!() to indicate that
mutually exclusive feature have been specified. This leads to problems
when running cargo doc --all-features, which will inevitably trigger
these conditions and then lead to documentation not building (for this
reason, the vhost documentation currently fails to build on docs.rs for
example).

Add a custom cfg that gets passed via RUSTFLAGS in the cargo doc CI step
on whose absense these compile_error!() macros can be gated, so that
they dont cause issues when building documentation in CI

A custom cfg is needed because cargo doc does not pass `--cfg doc` down
to dependencies.

See also rust-vmm/vhost#326

Signed-off-by: Patrick Roy <[email protected]>
@roypat roypat force-pushed the cargo-doc-workaround branch from 4de22b0 to b648303 Compare October 2, 2025 08:25
@ShadowCurse ShadowCurse merged commit 3e24835 into rust-vmm:main Oct 2, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants